package com.fhz.day00502.fragment;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.fhz.day00502.entity.Banner;
import com.fhz.day00502.entity.Food;
import com.fhz.day00502.repostroy.FoodRepostroy;
import com.fhz.day00502.utils.ApiResponse;

import java.util.List;

public class FoodViewModel extends ViewModel {

    private FoodRepostroy foodRepostroy;

    public FoodViewModel(FoodRepostroy foodRepostroy) {
        this.foodRepostroy = foodRepostroy;
    }

    private MutableLiveData<Food> foodMutableLiveData = new MutableLiveData<>();

    public MutableLiveData<Food> getFoodMutableLiveData() {
        return foodMutableLiveData;
    }

    public void setFoodData(Food data){
        foodMutableLiveData.postValue(data);
    }

    public LiveData<ApiResponse<List<Banner>>> getFood(){
        return foodRepostroy.getFood();
    }
}